<html>
 <head>
  <title>Configuration - SA Last Read</title>
  <link rel="stylesheet" href="configuration.css"/>
  <script language="JavaScript">

var persistObject = null;

function changePreview(pname) {
   var previewcol = document.getElementById(pname+"preview");
   var inputel = document.getElementById(pname);
   previewcol.style.backgroundColor = inputel.value;
}

function loadColorDefault(pname) {
   var inputel = document.getElementById(pname);
   inputel.value = persistObject["defaultcolor_"+pname];
   changePreview(pname);
}

function loadUrlDefault(pname) {
   var inputel = document.getElementById(pname);
   inputel.value = persistObject["defaulturl_"+pname];
}

function loadStringDefault(pname) {
   var inputel = document.getElementById(pname);
   inputel.value = persistObject["defaultstring_"+pname];
}

function setSelectFromValue(selname, value) {
   var selobj = document.getElementById(selname);
   for (var x=0; x<selobj.childNodes.length; x++) {
      if ( selobj.childNodes[x].value == value ) {
         selobj.selectedIndex = x;
      }
   }
}

function pullInValues() {
   try {
   persistObject = document.persistObject;

   document.getElementById("readLight").value = persistObject.color_readLight;
   document.getElementById("readDark").value = persistObject.color_readDark;
   document.getElementById("readWithNewLight").value = persistObject.color_readWithNewLight;
   document.getElementById("readWithNewDark").value = persistObject.color_readWithNewDark;
   document.getElementById("unreadLight").value = persistObject.color_unreadLight;
   document.getElementById("unreadDark").value = persistObject.color_unreadDark;
   document.getElementById("unreadLightFYAD").value = persistObject.color_unreadLightFYAD;
   document.getElementById("unreadDarkFYAD").value = persistObject.color_unreadDarkFYAD;
   document.getElementById("postedInThreadRe").value = persistObject.color_postedInThreadRe;
   document.getElementById("seenPostLight").value = persistObject.color_seenPostLight;
   document.getElementById("seenPostDark").value = persistObject.color_seenPostDark;
   document.getElementById("seenPostLightFYAD").value = persistObject.color_seenPostLightFYAD;
   document.getElementById("seenPostDarkFYAD").value = persistObject.color_seenPostDarkFYAD;
   document.getElementById("unseenPostLight").value = persistObject.color_unseenPostLight;
   document.getElementById("unseenPostDark").value = persistObject.color_unseenPostDark;
   document.getElementById("unseenPostLightFYAD").value = persistObject.color_unseenPostLightFYAD;
   document.getElementById("unseenPostDarkFYAD").value = persistObject.color_unseenPostDarkFYAD;
   changePreview("readLight");
   changePreview("readDark");
   changePreview("readWithNewLight");
   changePreview("readWithNewDark");
   changePreview("unreadLight");
   changePreview("unreadDark");
   changePreview("unreadLightFYAD");
   changePreview("unreadDarkFYAD");
   changePreview("postedInThreadRe");
   changePreview("seenPostLight");
   changePreview("seenPostDark");
   changePreview("seenPostLightFYAD");
   changePreview("seenPostDarkFYAD");
   changePreview("unseenPostLight");
   changePreview("unseenPostDark");
   changePreview("unseenPostLightFYAD");
   changePreview("unseenPostDarkFYAD");

   document.getElementById("goToLastReadPost").value = persistObject.url_goToLastReadPost;
   document.getElementById("markThreadUnvisited").value = persistObject.url_markThreadUnvisited;

   document.getElementById("showUnvisitIcon").checked = persistObject.toggle_showUnvisitIcon;
   document.getElementById("showGoToLastIcon").checked = persistObject.toggle_showGoToLastIcon;
   document.getElementById("alwaysShowGoToLastIcon").checked = persistObject.toggle_alwaysShowGoToLastIcon;
   document.getElementById("reanchorThreadOnLoad").checked = persistObject.toggle_reanchorThreadOnLoad;
   document.getElementById("useQuickQuote").checked = persistObject.toggle_useQuickQuote;
   document.getElementById("quickQuoteSubscribeDefault").checked = persistObject.toggle_quickQuoteSubscribeDefault;
   document.getElementById("quickQuoteSignatureDefault").checked = persistObject.toggle_quickQuoteSignatureDefault;
   document.getElementById("showSAForumMenu").checked = persistObject.toggle_showSAForumMenu;
   document.getElementById("nestSAForumMenu").checked = persistObject.toggle_nestSAForumMenu;

   setSelectFromValue( "threadIconOrder", persistObject.string_threadIconOrder );

   document.getElementById("persistStoragePath").value = persistObject.string_persistStoragePath;
   document.getElementById("forumListStoragePath").value = persistObject.string_forumListStoragePath;
   document.getElementById("menuPinnedForums").value = persistObject.string_menuPinnedForums;

   } catch(e) { alert("SALastRead pref init error: "+e); }
}

function doSubmit() {
   persistObject.color_readLight = document.getElementById("readLight").value;
   persistObject.color_readDark = document.getElementById("readDark").value;
   persistObject.color_readWithNewLight = document.getElementById("readWithNewLight").value;
   persistObject.color_readWithNewDark = document.getElementById("readWithNewDark").value;
   persistObject.color_unreadLight = document.getElementById("unreadLight").value;
   persistObject.color_unreadDark = document.getElementById("unreadDark").value;
   persistObject.color_unreadLightFYAD = document.getElementById("unreadLightFYAD").value;
   persistObject.color_unreadDarkFYAD = document.getElementById("unreadDarkFYAD").value;
   persistObject.color_postedInThreadRe = document.getElementById("postedInThreadRe").value;
   persistObject.color_seenPostLight = document.getElementById("seenPostLight").value;
   persistObject.color_seenPostDark = document.getElementById("seenPostDark").value;
   persistObject.color_seenPostLightFYAD = document.getElementById("seenPostLightFYAD").value;
   persistObject.color_seenPostDarkFYAD = document.getElementById("seenPostDarkFYAD").value;
   persistObject.color_unseenPostLight = document.getElementById("unseenPostLight").value;
   persistObject.color_unseenPostDark = document.getElementById("unseenPostDark").value;
   persistObject.color_unseenPostLightFYAD = document.getElementById("unseenPostLightFYAD").value;
   persistObject.color_unseenPostDarkFYAD = document.getElementById("unseenPostDarkFYAD").value;

   persistObject.url_goToLastReadPost = document.getElementById("goToLastReadPost").value;
   persistObject.url_markThreadUnvisited = document.getElementById("markThreadUnvisited").value;

   persistObject.toggle_showUnvisitIcon = document.getElementById("showUnvisitIcon").checked;
   persistObject.toggle_showGoToLastIcon = document.getElementById("showGoToLastIcon").checked;
   persistObject.toggle_alwaysShowGoToLastIcon = document.getElementById("alwaysShowGoToLastIcon").checked;
   persistObject.toggle_reanchorThreadOnLoad = document.getElementById("reanchorThreadOnLoad").checked;
   persistObject.toggle_useQuickQuote = document.getElementById("useQuickQuote").checked;
   persistObject.toggle_quickQuoteSubscribeDefault = document.getElementById("quickQuoteSubscribeDefault").checked;
   persistObject.toggle_quickQuoteSignatureDefault = document.getElementById("quickQuoteSignatureDefault").checked;
   persistObject.toggle_showSAForumMenu = document.getElementById("showSAForumMenu").checked;
   persistObject.toggle_nestSAForumMenu = document.getElementById("nestSAForumMenu").checked;

   var threadIconOrder = document.getElementById("threadIconOrder");
   var threadIconOrderValue = threadIconOrder.childNodes[threadIconOrder.selectedIndex].value;
   persistObject.string_threadIconOrder = threadIconOrderValue;
   persistObject.string_persistStoragePath = document.getElementById("persistStoragePath").value;
   persistObject.string_forumListStoragePath = document.getElementById("forumListStoragePath").value;
   persistObject.string_menuPinnedForums = document.getElementById("menuPinnedForums").value;

   persistObject.SavePrefs();

   alert("Changes have been saved.");
}
  </script>
 </head> 
 <body onload="pullInValues()">

  <div class="mainlinks">
   <a href="http://forums.somethingawful.com/index.php?s=">Something Awful Forums</a>
   -
   <a href="http://archive.somethingawful.com">Forum Archives</a>
   -
   <a href="http://www.somethingawful.com">Something Awful Website</a>
   -
   <a href="http://www.awfulmart.com">Buy SA Merchandise!</a>
   -
   <a href="http://www.somethingawful.com/shop">Shop Through SA Affiliates</a>
  </div>

  <div class="minorlinks1">
   <a href="http://www.somethingawful.com/forumsystem/index.php?item=custom_title">Change your Custom Title</a>
   -
   <a href="http://www.somethingawful.com/forumsystem/index.php?item=others_custom_title">Change User's Custom Title</a>
   -
   <a href="http://www.somethingawful.com/forumsystem/index.php?item=rename">Change Your Username</a>
   -
   <a href="http://www.somethingawful.com/forumsystem/index.php?item=banner_ad">Buy a Banner Ad</a>
   -
   <a href="http://www.somethingawful.com/forumsystem/index.php?item=register">Register an Account</a>
   -
   <a href="http://www.somethingawful.com/forumsystem/index.php?item=donate">Donate to SA</a>
   -
   <a href="http://www.somethingawful.com/forumsystem/index.php?item=platinum">Upgrade User to Platinum</a>
   -
   <a href="http://www.somethingawful.com/forumsystem/index.php?item=noads">Remove All Ads</a>
   -
   <a href="http://www.somethingawful.com/forums/bonus.htm">Purchase Bonus Features</a>
  </div>

  <div class="minorlinks2">
   <a href="http://forums.somethingawful.com/usercp.php?s=">User Control Panel</a>
   -
   <a href="chrome://salastread/content/configuration.html">Configure Last Read Extension</a>
   -
   <a href="http://forums.somethingawful.com/search.php?s=">Search the Forums</a>
   -
   <a href="http://forums.somethingawful.com/memberlist.php?s=">Member Directory</a>
   -
   <a href="http://forums.somethingawful.com/private.php?s=">Private Messages</a>
   -
   <a href="http://www.somethingawful.com/images/ps-sa-tag.zip">Download the SA Forums PSD tag</a>
   -
   <a href="http://forums.somethingawful.com/calendar.php">Calendar</a>
   -
   <a href="http://www.somethingawful.com/forumrules/">Forum Rules</a>
   -
   <a href="http://forums.somethingawful.com/dictionary.php">Dictionary/FAQ</a>
   -
   <a href="http://forums.somethingawful.com/member.php?s=&action=logout">Log Out</a>
  </div>

  <div class="contentbox">
   <div class="contenttitle">
    Last Read Extension Configuration
   </div>
   <div class="contentdesc">
    Choose which colors you wish to use below:
   </div>
   <table class="contenttable">
    <tr>
     <td class="labelcol">Unread Thread (Light)</td>
     <td class="colorcol" id="unreadLightpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="unreadLight" name="unreadLight" value="" size="8" onchange="changePreview('unreadLight')"/>
      <button onclick="loadColorDefault('unreadLight')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Unread Thread (Dark)</td>
     <td class="colorcol" id="unreadDarkpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="unreadDark" name="unreadDark" value="" size="8" onchange="changePreview('unreadDark')"/>
      <button onclick="loadColorDefault('unreadDark')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Unread Thread (Light) in FYAD</td>
     <td class="colorcol" id="unreadLightFYADpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="unreadLightFYAD" name="unreadLightFYAD" value="" size="8" onchange="changePreview('unreadLightFYAD')"/>
      <button onclick="loadColorDefault('unreadLightFYAD')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Unread Thread (Dark) in FYAD</td>
     <td class="colorcol" id="unreadDarkFYADpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="unreadDarkFYAD" name="unreadDarkFYAD" value="" size="8" onchange="changePreview('unreadDarkFYAD')"/>
      <button onclick="loadColorDefault('unreadDarkFYAD')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Read With New Thread (Light)</td>
     <td class="colorcol" id="readWithNewLightpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="readWithNewLight" name="readWithNewLight" value="" size="8" onchange="changePreview('readWithNewLight')"/>
      <button onclick="loadColorDefault('readWithNewLight')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Read With New Thread (Dark)</td>
     <td class="colorcol" id="readWithNewDarkpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="readWithNewDark" name="readWithNewDark" value="" size="8" onchange="changePreview('readWithNewDark')"/>
      <button onclick="loadColorDefault('readWithNewDark')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Read Thread (Light)</td>
     <td class="colorcol" id="readLightpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="readLight" name="readLight" value="" size="8" onchange="changePreview('readLight')"/>
      <button onclick="loadColorDefault('readLight')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Read Thread (Dark)</td>
     <td class="colorcol" id="readDarkpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="readDark" name="readDark" value="" size="8" onchange="changePreview('readDark')"/>
      <button onclick="loadColorDefault('readDark')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Seen Post (Light)</td>
     <td class="colorcol" id="seenPostLightpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="seenPostLight" name="seenPostLight" value="" size="8" onchange="changePreview('seenPostLight')"/>
      <button onclick="loadColorDefault('seenPostLight')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Seen Post (Dark)</td>
     <td class="colorcol" id="seenPostDarkpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="seenPostDark" name="seenPostDark" value="" size="8" onchange="changePreview('seenPostDark')"/>
      <button onclick="loadColorDefault('seenPostDark')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Seen Post (Light) in FYAD</td>
     <td class="colorcol" id="seenPostLightFYADpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="seenPostLightFYAD" name="seenPostLightFYAD" value="" size="8" onchange="changePreview('seenPostLightFYAD')"/>
      <button onclick="loadColorDefault('seenPostLightFYAD')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Seen Post (Dark) in FYAD</td>
     <td class="colorcol" id="seenPostDarkFYADpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="seenPostDarkFYAD" name="seenPostDarkFYAD" value="" size="8" onchange="changePreview('seenPostDarkFYAD')"/>
      <button onclick="loadColorDefault('seenPostDarkFYAD')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Unseen Post (Light)</td>
     <td class="colorcol" id="unseenPostLightpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="unseenPostLight" name="unseenPostLight" value="" size="8" onchange="changePreview('unseenPostLight')"/>
      <button onclick="loadColorDefault('unseenPostLight')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Unseen Post (Dark)</td>
     <td class="colorcol" id="unseenPostDarkpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="unseenPostDark" name="unseenPostDark" value="" size="8" onchange="changePreview('unseenPostDark')"/>
      <button onclick="loadColorDefault('unseenPostDark')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Unseen Post (Light) in FYAD</td>
     <td class="colorcol" id="unseenPostLightFYADpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="unseenPostLightFYAD" name="unseenPostLightFYAD" value="" size="8" onchange="changePreview('unseenPostLightFYAD')"/>
      <button onclick="loadColorDefault('unseenPostLightFYAD')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Unseen Post (Dark) in FYAD</td>
     <td class="colorcol" id="unseenPostDarkFYADpreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="unseenPostDarkFYAD" name="unseenPostDarkFYAD" value="" size="8" onchange="changePreview('unseenPostDarkFYAD')"/>
      <button onclick="loadColorDefault('unseenPostDarkFYAD')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">Posted in Thread Replies Column Highlight</td>
     <td class="colorcol" id="postedInThreadRepreview">Sample</td>
     <td class="inputcol">
      <input type="text" id="postedInThreadRe" name="postedInThreadRe" value="" size="8" onchange="changePreview('postedInThreadRe')"/>
      <button onclick="loadColorDefault('postedInThreadRe')">Default</button>
     </td>
    </tr>
   </table>
   <div class="contentdesc">
    Choose which images you wish to use below. You may uncheck the checkbox
    next to an icon's title to completely disable use of that icon:
   </div>
   <table class="contenttable">
    <tr>
     <td class="labelcol">
      <input type="checkbox" name="showGoToLastIcon" id="showGoToLastIcon"/>
      <label for="showGoToLastIcon">Go To Last Read Post</label>
     </td>
     <td class="urlinputcol">
      <input type="text" name="goToLastReadPost" id="goToLastReadPost" size="40"/>
      <button onclick="loadUrlDefault('goToLastReadPost')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">
      <input type="checkbox" name="showUnvisitIcon" id="showUnvisitIcon"/>
      <label for="showUnvisitIcon">Mark Thread Unvisited</label>
     </td>
     <td class="urlinputcol">
      <input type="text" name="markThreadUnvisited" id="markThreadUnvisited" size="40"/>
      <button onclick="loadUrlDefault('markThreadUnvisited')">Default</button>
     </td>
    </tr>
   </table>
   <div class="contentdesc">
    <select name="threadIconOrder" id="threadIconOrder" style="float: right">
     <option value="12">"Go To Post" &gt; "Unvisit"</option>
     <option value="21">"Unvisit" &gt; "Go To Post"</option>
    </select>
    Which order do you want the icons to appear? (Icons you've unchecked above will not
    show, no matter where they are in the order.)
   </div>
   <table class="contenttable">
    <tr>
     <td class="toggles">
      <input type="checkbox" name="alwaysShowGoToLastIcon" id="alwaysShowGoToLastIcon" />
      Show "Go To Last Read Post" icon even if there aren't new posts in the thread.
     </td>
    </tr>
    <tr>
     <td class="toggles">
      <input type="checkbox" name="reanchorThreadOnLoad" id="reanchorThreadOnLoad" />
      Reanchor a thread to the targetted post after all images have loaded.
     </td>
    </tr>
    <tr>
     <td class="toggles">
      <input type="checkbox" name="useQuickQuote" id="useQuickQuote" />
      Use "Quick Quote" buttons for in-page replies. (Shift-click for normal quote.)
     </td>
    </tr>
    <tr>
     <td class="toggles">
      <input type="checkbox" name="quickQuoteSubscribeDefault" id="quickQuoteSubscribeDefault" />
      Default "Subscribe" checkbox to on in "Quick Quote" windows.
     </td>
    </tr>
    <tr>
     <td class="toggles">
      <input type="checkbox" name="quickQuoteSignatureDefault" id="quickQuoteSignatureDefault" />
      Default "Show Signature" checkbox to on in "Quick Quote" windows. (For your first post in a thread only.)
     </td>
    </tr>
    <tr>
     <td class="toggles">
      <input type="checkbox" name="showSAForumMenu" id="showSAForumMenu" />
      Show SA Forum Quick Jump Menu (change requires Firefox restart)
     </td>
    </tr>
    <tr>
     <td class="toggles">
      <input type="checkbox" name="nestSAForumMenu" id="nestSAForumMenu" />
      Use nested submenus on SA Forum Quick Jump Menu (change requires Firefox restart)
     </td>
    </tr>
   </table>
   <table class="contenttable">
    <tr>
     <td class="labelcol">
      <label for="persistStoragePath">Persist Data Store Path</label>
      <p style="font-size: 80%">Start path with "%profile%" to store the file in your Firefox profile directory. You
      must restart Firefox for any change to this value to take effect.</p>
     </td>
     <td class="urlinputcol">
      <input type="text" name="persistStoragePath" id="persistStoragePath" size="40"/>
      <button onclick="loadStringDefault('persistStoragePath')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">
      <label for="forumListStoragePath">Forum List Data Store Path</label>
      <p style="font-size: 80%">Start path with "%profile%" to store the file in your Firefox profile directory. You
      must restart Firefox for any change to this value to take effect.</p>
     </td>
     <td class="urlinputcol">
      <input type="text" name="forumListStoragePath" id="forumListStoragePath" size="40"/>
      <button onclick="loadStringDefault('forumListStoragePath')">Default</button>
     </td>
    </tr>
    <tr>
     <td class="labelcol">
      <label for="menuPinnedForums">Pinned Forums</label>
      <p style="font-size: 80%">Enter a list of forum numbers, seperated by commas. The forums listed will be
      pinned to the bottom of the SA Forum Quick Jump menu if you have it set to nest by categories.</p>
     </td>
     <td class="urlinputcol">
      <input type="text" name="menuPinnedForums" id="menuPinnedForums" size="40"/>
      <button onclick="loadStringDefault('menuPinnedForums')">Default</button>
     </td>
    </tr>
   </table>
   <div class="contentsubmit">
    <button onclick="doSubmit()">Save Changes</button>
   </div>
  </div>

 </body>
</html>
